package day07;

import java.util.Scanner;

/**
 * Created by Shinelon on 2016/9/20.
 */
public abstract class ATM {

    private String name = "";
    private String menu = "";

    public abstract void other(Card card);

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMenu() {
        return menu;
    }

    public void setMenu(String menu) {
        this.menu = menu;
    }

    Scanner scan =new Scanner(System.in);

    public void getBalance(Card card){
        System.out.println("您的余额为：" +  card.getBalance());
    }

    public  void getMoney(Card card){
        System.out.println("请输入要取得金额");
        int read=scan.nextInt();
        if (read<card.getBalance()&&read>0){
            if (read%100==0){
                System.out.println("取现成功");
                card.setBalance(card.getBalance() - read);
            }else {
                System.out.println("取现失败");
            }
        }else {
            System.out.println("余额不足");
        }
    }
    public void cunMoney(Card card){
        System.out.println("请输入要存的金额");
        int read=scan.nextInt();
        if (read>0){
            if (read%100==0){
                System.out.println("存钱成功");
                card.setBalance(card.getBalance()+ read);
            }else {
                System.out.println("存钱失败");
            }
        }else {
            System.out.println("存负？？？");
        }
    }
    public void exit(Card card){
        System.out.println("返回");
    }
}